home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / c / delete.c < prev    next >
C/C++ Source or Header  |  1996-09-13  |  856b  |  45 lines

  1. #include <exec/memory.h>
  2. #include <exec/execbase.h>
  3. #include <clib/exec_protos.h>
  4. #include <dos/dos.h>
  5. #include <clib/dos_protos.h>
  6. #include <utility/tagitem.h>
  7.  
  8. CALLENTRY /* Before the first symbol */
  9.  
  10. struct ExecBase *SysBase;
  11. struct DosLibrary *DOSBase;
  12.  
  13. static LONG tinymain(void);
  14.  
  15. LONG entry(struct ExecBase *sysbase)
  16. {
  17.     LONG error=RETURN_FAIL;
  18.     SysBase=sysbase;
  19.     DOSBase=(struct DosLibrary *)OpenLibrary("dos.library",39);
  20.     if(DOSBase!=NULL)
  21.     {
  22.     error=tinymain();
  23.     CloseLibrary((struct Library *)DOSBase);
  24.     }
  25.     return error;
  26. }
  27.  
  28. static LONG tinymain(void)
  29. {
  30.     STRPTR args[1]={ 0 };
  31.     struct RDArgs *rda;
  32.     LONG error=0;
  33.  
  34.     rda=ReadArgs("FILE/A",(IPTR *)args,NULL);
  35.     if(rda!=NULL)
  36.     {
  37.     DeleteFile(args[0]);
  38.     FreeArgs(rda);
  39.     }else
  40.     error=RETURN_FAIL;
  41.     if(error)
  42.     PrintFault(IoErr(),"Delete");
  43.     return error;
  44. }
  45.